package com.jinlia.show.modules.system.controller;

import com.jinlia.show.modules.base.system.entity.MemberCardScoreChange;
import com.jinlia.show.modules.base.system.service.MemberCardScoreChangeMapperService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/member/score")
public class MemberCardScoreChangeController {
    @Autowired
    MemberCardScoreChangeMapperService memberCardScoreChangeMapperService;
    @PostMapping("/card/{id}")
    public List<MemberCardScoreChange> get(@PathVariable(value = "id") Long id) {
        List<MemberCardScoreChange> list = memberCardScoreChangeMapperService.lambdaQuery()
                .eq(MemberCardScoreChange::getMemberCardId, id)
                .orderByDesc(MemberCardScoreChange::getId)
                .list();
        return list;
    }
}
